package models

import (
	"time"

	"github.com/shopspring/decimal"
)

// HlPayAccountBalance HlPay账户余额模型
type HlPayAccountBalance struct {
	ID              int64           `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
	AccountNo       string          `gorm:"column:account_no;type:varchar(64);uniqueIndex:uk_account_no;not null" json:"account_no"`
	Currency        string          `gorm:"column:currency;type:varchar(10);not null;index:idx_currency" json:"currency"`
	MemberID        string          `gorm:"column:member_id;type:varchar(32);not null;index:idx_member_id" json:"member_id"`
	OwnerNo         string          `gorm:"column:owner_no;type:varchar(64);not null;index:idx_owner_no" json:"owner_no"`
	OwnerType       string          `gorm:"column:owner_type;type:varchar(20);not null;default:'matrix'" json:"owner_type"`
	RealTimeBalance decimal.Decimal `gorm:"column:real_time_balance;type:decimal(20,2);not null;default:0.00" json:"real_time_balance"`
	Status          string          `gorm:"column:status;type:varchar(20);not null;default:'active';index:idx_status" json:"status"`
	CreatedAt       time.Time       `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP" json:"created_at"`
	UpdatedAt       time.Time       `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" json:"updated_at"`
}

// TableName 获取表名
func (HlPayAccountBalance) TableName() string {
	return "hlpay_account_balances"
}

// HlPayAccountBalanceResponse hlpay账户余额响应
type HlPayAccountBalanceResponse struct {
	AccountNo       string          `json:"accountNo"`       // 账户号
	Currency        string          `json:"currency"`        // 货币类型
	MemberID        string          `json:"memberId"`        // 会员ID
	OwnerNo         string          `json:"ownerNo"`         // 所有者编号
	OwnerType       string          `json:"ownerType"`       // 所有者类型
	RealTimeBalance decimal.Decimal `json:"realTimeBalance"` // 实时余额
}
